package com.jiangli.mapper;

import com.jiangli.entity.Dish;
import com.jiangli.entity.UserFavorite;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CollectMapper {
    @Select("select * from user_favorite where user_id=#{userId} and dish_id=#{dishId}")
    UserFavorite selectByuserIdAnddishId(Long userId, Long dishId);

    @Insert("insert into user_favorite(user_id,dish_id) values (#{userId},#{dishId})")
    void insertDish(Long userId, Long dishId);

    @Select("select dish_id from user_favorite where user_id=#{userId}")
    List<Long> selectUserCollecDishIdtListById(Long userId);
}
